<?php
	require_once('../config.php');
	include_once("../database/DataBase.php");
	include_once("../include/function.php");
				
	session_start();
	checkLogin();
	
	$database = New DataBase();
	$database->open_connection();
?>

<html>
	<head>
		<title>CMS - Item</title>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
		<?php
			include_once("../include/includeHeader.php");
		?>
		<link rel="Stylesheet" type="text/css" href="<?echo $config["root"];?>/css/jHtmlArea.css" />
		<script type="text/javascript" src="<?echo $config["root"];?>/js/jHtmlArea"></script>
		<script type="text/javascript">
		
			$(document).ready(function(){
			
				$('.cat_desc').each(function(){
					$(this).htmlarea();
				});
			});
		
			function submitCheck(){
				var message;
				var count;

				message = "";
				count = 0;
				$('.cat_name').each(function(){
					if ($(this).val() != ""){
						count++;
					}
				});
				
				if(count > 0){
					 $('#newCategory').submit();
				}
				else{
					alert("Please input Category name");
				}
			}
		</script>
	</head>
	<body>
		<?php
			include_once("../include/top_navigation.php");
		?>
		<div Class="Middle">
			<div class="LeftMenu" >
				<?php include_once("../include/left_menu.php"); ?>
			</div>
			<div id="RightContent" >
			<form name="newCategory" id="newCategory" method="POST" action="../include/product_add_category_process.php">
				<table border="0">
				
					<?php
						for($i=1;$i<=$config["max_language"];$i++){
					?>

				
					<tr>
						<td colspan="2">Language : <? echo $i;?></td>
					</tr>
					<tr>
						<td>Category Name:</td>
						<td><input type="text" name="cat_name[]" id="cat_name" class="cat_name" value="" /></td>
					</tr>
					<tr>
						<td>Description</td>
						<td><textarea name="cat_desc[]" id="cat_desc" class="cat_desc" rows="4" cols="100"></textarea></td>
					</tr>
					<tr><td>&nbsp;</td></tr>
					<?
						}
					?>
					<tr>
						<td colspan="2"><input type="button" name="button" value="Submit" onclick="javascript: submitCheck();" /></td>
					</tr>
				</table>
			</form>
			</div>
		</div>
		<?php
			include_once("../include/footer.php");
		?>
	</body>
</html>
<?
	$database->close_connection();
?>